home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-07-15 | 2.9 KB | 106 lines | [TEXT/MPS ] |
- // About.cp
- // Copyright © 1992 by Apple Computer, Inc. All rights reserved.
- // Kent Sandvik DTS
- // This file contains the About box code including any adorners/behaviors
- // The resources are placed in the project .r file
- // Version Info (latest first):
- //
- // <1> khs 1.0 First final version
- // <2> khs 1.0.1 Fixed a memory leak in TMapApplication::GetSleepValue()
-
-
- #ifndef __ABOUT__
- #include "About.h"
- #endif
-
-
- // Functions
-
- #pragma segment ARes
- void CreateAboutBox()
- {
- TWindow * aboutBoxWindow;
- CStr255 programName, versionInfo, finalProduct;
-
- // Yes, I do know this is a waste of resources to 'macroDontDeadStrip' and
- // register the adorner type every time we open the About box. However, for the
- // sake of modularity, where I only need to place a CreateAboutBox() statement
- // inside the TApplication->DoAboutBox(), it made sense - instead of writing all
- // kinds of init methods that need to be called from IApplication.
-
- if (gDeadStripSuppression) // so the linker doesn't dead strip class info
- macroDontDeadStrip(TMetalBlueFill);
-
- RegisterStdType("TMetalBlueFill", kBlueMetalLook);// register adorner types
-
- // Get application name
- gApplication->GetApplicationName(programName);
-
- // Get version information
- VersRecHndl versInfo = (VersRecHndl)GetResource(kVersInfoType, kVers1InfoID);
- if (versInfo) // short one?
- versionInfo = (**versInfo).shortVersion;// get version info from version 1
- else
- versionInfo = " "; // nooooothing
-
-
- // Create Window
- aboutBoxWindow = gViewServer->NewTemplateWindow(phAboutBox, NULL);
- FailNIL(aboutBoxWindow);
-
- // Hook in any adorners
- aboutBoxWindow->AddAdorner(NewStdAdorner('blmt', "", 'blmt', kFreeOnDeletion), kAdornBefore, kRedraw);
-
- // Stuff in the version info to the other status view, but first get a ptr to it...
- TStaticText * versionField = (TStaticText *)aboutBoxWindow->FindSubView('sta2');
- finalProduct = programName + CStr255(" ") + versionInfo;
- versionField->SetText(finalProduct, TRUE);
-
- // Open the About box window, and let the user close it whenever...
- aboutBoxWindow->Open();
- }
-
-
- // About Box color adorner
-
- CRGBColor gMetalBlue(26312,
- 14340,
- 47359); // Setup the metal-blue color
-
-
- // Empty constructor - for avoiding ptabs in global data space
- #pragma segment ARes
- TMetalBlueFill::TMetalBlueFill()
- {
- }
-
-
- // Draw TGrayFill Adorner method
-
- #pragma segment ARes
- pascal void TMetalBlueFill::Draw(TView* itsView,
- const VRect& /*area*/)
- {
- CRGBColor saveColor;
- PenState savePenState;
- VRect adornArea;
- CRect QDArea;
- CRect tempRect;
-
- GetPenState(savePenState); // save off the current pen state
- GetIfColor(saveColor); // and the foreground color
- PenNormal();
-
- itsView->GetAdornExtent(adornArea); // get area
- itsView->ViewToQDRect(adornArea, QDArea);
- tempRect = QDArea;
-
- SetIfColor(gMetalBlue); // colorize it
- PaintRect(tempRect);
-
- SetIfColor(saveColor); // restore the foreground color and the pen
- SetPenState(savePenState);
- }
-
-
-